//TryCatchTest.java
package com.ylaihui.exception;

import org.junit.Test;

public class TryCatchTest {

	@Test
	public void test1(){
		String str = "abc";
		try{
			Integer i = Integer.parseInt(str);
			System.out.println("not exec here!");
		}catch(NumberFormatException e){
			System.out.println("process NumberFormatException...");
//			System.out.println(e.getMessage());
//			System.out.println("----------------");
//			e.printStackTrace();
		}catch(NullPointerException e){
			System.out.println("process NullPointerException");
		}
		System.out.println("exec here!");
		// 在try结构中声明的变量，再出了try结构以后，就不能再被调用
//		System.out.println(i);
	}
	
	/*
	 process NumberFormatException...
	 exec here!
	 */
}
